package lib.bone.access.module.dict.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.Hibernate;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;
import java.util.Objects;

/**
 * @Author : 贾斯淇
 */

/**
 * @Author : 贾斯淇
 */
@Getter
@Setter
@ToString
@RequiredArgsConstructor
@Entity
@Table(name="nepu_thinktank_dict")
@EntityListeners(AuditingEntityListener.class)
@ApiModel(value="智库类成果词典")
@GenericGenerator(name = "jpa-uuid", strategy = "uuid")
public class NepuThinkTankDict {
    @Id
    @GeneratedValue(generator = "jpa-uuid")
    @ApiModelProperty(value = "智库类成果词典ID",name = "id")
    String id;
    /**
     * 词典编码
     */
    @ApiModelProperty("词典编码")
    @Column(name = "code")
    String code;
    @ApiModelProperty(value="智库类成果类型",notes="国家社科基金《成果要报》等.")
    @Column(name="thinktank_type")
    String thinktankType;

    @ApiModelProperty(name="智库类成果类别",notes = "A.B")
    @Column(name="thinktank_level")
    String thinktankLevel;

    @ApiModelProperty(value = "工作量Min",notes = "获奖对应的最小工作量")
    @Column(name = "workload_min")
    Integer workloadMin;
    @ApiModelProperty(value = "工作量Max",notes = "获奖对应的最大工作量")
    @Column(name = "workload_max",scale = 2)
    Double workloadMax;

    @ApiModelProperty(value = "智库类成果词典备注")
    @Column(name = "remark")
    String remark;

    @CreatedDate
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @ApiModelProperty(value = "记录创建时间",name = "createdTime")
    @Column(name = "created_time")
    private Date createdTime;
    @LastModifiedDate
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @ApiModelProperty(value = "记录更新时间",name = "updatedTime")
    @Column(name = "updated_time")
    private Date updatedTime;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
        NepuThinkTankDict nepuThinkTankDict = (NepuThinkTankDict) o;
        return id != null && Objects.equals(id, nepuThinkTankDict.id);
    }

    @Override
    public int hashCode() {
        return getClass().hashCode();
    }
}
